// ignore_for_file: dangling_library_doc_comments, slash_for_doc_comments
import 'package:flutter/material.dart';

/*** 
 * @Author: Zhong
 * @Date: 2025-07-22 17:11:54
 * @LastEditors: Zhong zhongxiaodong@eenet.com
 * @LastEditTime: 2025-08-12 15:13:51
 * @FilePath: /wan_android_flutter/lib/common_code/widgets/custom_sliver_header_delegate.dart
 * @Description: 
 */

class CustomSliverHeaderDelegate extends SliverPersistentHeaderDelegate {
  final double minHeight; // 最小高度
  final double maxHeight; // 最大高度
  final Widget child; // 头部内容

  CustomSliverHeaderDelegate({
    required this.minHeight,
    required this.maxHeight,
    required this.child,
  });

  @override
  double get minExtent => minHeight;

  @override
  double get maxExtent => maxHeight;

  @override
  Widget build(
    BuildContext context,
    double shrinkOffset,
    bool overlapsContent,
  ) {
    return SizedBox.expand(child: child);
  }

  @override
  bool shouldRebuild(covariant CustomSliverHeaderDelegate oldDelegate) {
    // return oldDelegate.minHeight != minHeight ||
    //     oldDelegate.maxHeight != maxHeight ||
    //     oldDelegate.child != child;

    return false;
  }
}
